package com.wuyou.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wuyou.domain.bo.AdvPayLogBO;
import com.wuyou.domain.po.AdvPayLog;
import com.wuyou.mapper.AdvPayLogMapper;
import com.wuyou.service.IAdvPayLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 刘雷雨
 * @since 2022-09-29
 */
@Service
public class AdvPayLogServiceImpl extends ServiceImpl<AdvPayLogMapper, AdvPayLog> implements IAdvPayLogService {

    @Autowired
    private AdvPayLogMapper advpayLogMapper;

    @Override
    public Integer updateAdvPayInfoByOrderNum(AdvPayLogBO advPayLogBO) {
        //BO转PO
        AdvPayLog advPayLog = new AdvPayLog();
        BeanUtils.copyProperties(advPayLogBO,advPayLog);
        advPayLog.setStatus(1);//1 = 已支付
        UpdateWrapper<AdvPayLog> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("order_num",advPayLogBO.getOrderNum());
        return advpayLogMapper.update(advPayLog,updateWrapper);
    }
}
